<?php
// 正式运行环境下请将以下常量设为FALSE
define('IN_APP', TRUE);
define('SYS_DEBUG', TRUE);
!defined('DS') && define('DS', DIRECTORY_SEPARATOR);
define('APP_ROOT', dirname(dirname(__FILE__).'../') . DS);
define('INCLUDES', APP_ROOT . 'include' . DS);
define('LIBRARYS', APP_ROOT . 'library' . DS);

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', SYS_DEBUG);
ini_set('error_log', 'log/phperror.txt');
date_default_timezone_set('Asia/Shanghai');

if (get_magic_quotes_gpc()) {
    function _stripslashes_rcurs($variable, $top = true) {
        $clean_data = array();
        foreach($variable as $key => $value) {
            $key = ($top) ? $key : stripslashes($key);
            $clean_data[$key] = (is_array($value)) ?
                _stripslashes_rcurs($value, false) : stripslashes($value);
        }
        return $clean_data;
    }
    $_GET = _stripslashes_rcurs($_GET);
    $_POST = _stripslashes_rcurs($_POST);
    $_REQUEST = _stripslashes_rcurs($_REQUEST);
    $_COOKIE = _stripslashes_rcurs($_COOKIE);
}
$PHP_SELF = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$BASESCRIPT = basename($PHP_SELF);
$siteurl = htmlspecialchars('http://'.$_SERVER['HTTP_HOST'].substr($PHP_SELF, 0, strrpos($PHP_SELF, '/')).'/');
$action = '';
$action = (isset($_GET['a'])) ? $_GET['a'] : $action;
$action = (isset($_POST['a'])) ? $_POST['a'] : $action;
require_once APP_ROOT . 'config.inc.php';
require_once INCLUDES . 'mysql.class.php';
$db = new db_mysql();
$db -> connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
require_once INCLUDES . 'template.class.php';
$view = new Template();
$view->assign('appname', 'ISUX EXAMINER');
$view->assign('siteurl', $siteurl);